package util;

import java.util.List;
import java.util.Random;

/**
 * Created by Administrator on 2017/10/16.
 */
public class RandomUtil {

    public static Random getRandom() {
        return new Random();
    }

    public static void randomList(List list) {
        int maxIndex = (list == null ? -1 : list.size() - 1);
        for (int i = 0; i < maxIndex; i++) {
            int p = new Random().nextInt(maxIndex);
            Object temp = list.get(i);
            list.set(i, list.get(p));
            list.set(p, temp);
        }
    }


}
